<template>
  <div>
    <v-card title="基础散点图">
      <vcu-chart-scatter :data="chartData" />
    </v-card>
  </div>
</template>

<script>
export default {
  name: "basic",
  data() {
    return {
      chartData: null,
    };
  },
  methods: {
    // 根据指定范围生成随机数
    rangeRandom(min, max, precision) {
      return (Math.random() * (max - min) + min).toFixed(precision);
    },
  },
  created() {
    const randomData = [];

    for (let i = 0; i < 50; i++) {
      randomData.push([
        this.rangeRandom(20, 200, 2),
        this.rangeRandom(10, 100, 2),
      ]);
    }
    this.chartData = {
      dimensions: {
        data: ["随机值"],
      },
      measures: [
        {
          name: "随机分布数据",
          data: randomData,
        },
      ],
    };
  },
};
</script>
<style lang="less" scoped>
</style>
